<?php
declare(strict_types=1);
namespace app\api\controller;

use app\api\logic\LoginLogic;
use app\api\logic\SampleLogic;
use app\common\service\TokenService;
use think\facade\Request;

/**
 * 示例
 */
class Sample extends ApiBase{
    /**
     * 使用示例
     * @return \think\response\Json
     */
    public function index(){
        return $this->returnData(LoginLogic::index($this->params));
    }

    public function token(){
        $Ks = new TokenService(['type'=> 'ad','conValue'=>'cs']);

        $res = $Ks->createAccessToken(["user_name"=>"admin","password"=>"admin888"]);
       var_dump($res);
    }
    public function getAccessTokenInfo(){
        $Ks = new TokenService(['type'=> 'ad','conValue'=>'cs']);
        Request::withHeader(['Access-Token'=>'lKwJE0usECeCerd9f8xTtQAZ42WnODREccqq84hcrOhHxX6pxFoqCS7tslD%2FJsWa']);

        $res = $Ks->getAccessTokenInfo(["user_name"=>"admin","password"=>"admin888"]);
       var_dump($res);
    }

    public function getOauthCode(){
        $Ks = new TokenService(['type'=> 'qa','conValue'=>'cs']);
        $res = $Ks->getOauthCode(["app_id"=>"kj234nfygfl","redirect_uri"=>"http://mapi.helibuy.cn","member_id"=>1]);
       var_dump($res);
    }
    public function createAccessToken(){
        $Ks = new TokenService(['type'=> 'qa','conValue'=>'cs']);
        $res = $Ks->createAccessToken(["app_id"=>"kj234nfygfl","redirect_uri"=>"http://mapi.helibuy.cn","code"=>"947BAA8F265DC7BA41064AFF12280B85"]);
       var_dump($res);
    }
    public function getQaAccessTokenInfo(){
        $Ks = new TokenService(['type'=> 'qa','conValue'=>'cs']);
        $res = $Ks->getAccessTokenInfo(["uid"=>"a0b923820dcc509a","access_token"=>"bjtw%2BJTw4zpOZ1oF0mBMKZcarsP%2FWlMD7yD6JWvCR9dPDPCvSoLdaTnz7ykum6DT"]);
       var_dump($res);
    }

}
